<?php
$lang = $_REQUEST['lang'];
$company = $_REQUEST['company'];
$listtester = $_REQUEST['listtester'];
$from = $_REQUEST['from'];
$nameproject = $_REQUEST['nameproject'];

if (empty($lang) || $lang == "EN") {
	$value = "value/value_en.php";
} else if($lang == "VN") {
	$value = "value/value_vn.php";
}
else {
	$value = "value/value_kr.php";
}
include($value);

include 'connection.php';
set_time_limit(0);

$selectempl = mysql_query("SELECT FullName,UserName,Email from employee WHERE employee.IDEmployee in (".$listtester.")");

require_once('class.phpmailer.php');
while($row=mysql_fetch_array($selectempl)){
	$mail = new PHPMailer();
	$mail->IsSMTP();
	$mail->SMTPDebug  = 2;                    
	$mail->SMTPAuth   = true;                  
	$mail->SMTPSecure = "ssl";
	$mail->Host       = "smtp.gmail.com";     
	$mail->Port       = 465;                     
	$mail->Username   = "elisoftmailserver@gmail.com"; 
	$mail->Password   = "1234567892727";    
	$mail->SetFrom('elisoftmailserver@gmail.com',$company);
	$mail->AddAddress($row['Email'], $row['FullName']);
	$today=date("Y-m-d", time());
	$mail->Subject    ='Notice: '.$nameproject.' project has got new version '.$today.'  ( '.$l_from.' ['.$from.'] '.$l_to.' ['.$row['FullName'].'] )';
	$mail->CharSet = "utf-8";
	$mail->IsHTML(true);
	$body ='Notice: '.$nameproject.' project has got new version '.$today; 
	$mail->Body = $body;
		$mail->AltBody=$dtitle;
		if(!$mail->Send()) {
		//	echo "Errorr";
		} else {
		//	echo "Error2";
		}
}
?>